Crate autotools

source ·
Expand description

A build dependency for running the correct autotools commands to build a native library

This crate provides the facilities to setup the build system and build native libraries that leverage autotools or configure & make workalike scripts.

§Autotools configure concern

The generated configure script that is often bundled in release tarballs tends to be fairly big, convoluted and at least once has been a vector for delivering malicious code (CVE-2024-3094).

It is advised to review configure.ac and always regenerate configure using reconf.

§Installation

Add to your Cargo.toml a build dependency:

[build-dependencies]
autotools = "0.2"

§Usage

use autotools;

// Build the project in the path `foo` and installs it in `$OUT_DIR`
let dst = autotools::build("foo");

// Simply link the library without using pkg-config
println!("cargo:rustc-link-search=native={}", dst.display());
println!("cargo:rustc-link-lib=static=foo");
use autotools::Config;

let dst = Config::new("foo")
    .reconf("-ivf")
    .enable("feature", None)
    .with("dep", None)
    .disable("otherfeature", None)
    .without("otherdep", None)
    .cflag("-Wall")
    .build();

Structs§

  • Builder style configuration for a pending autotools build.

Functions§

  • Builds the native library rooted at path with the default configure options. This will return the directory in which the library was installed.